<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AJAX概念和axios使用</title>
</head>

<body>
    <a href="https://www.bilibili.com/video/BV1MN411y7pw?p=2&vd_source=480c28921b1b6c12cb33e4a6f0a94947">学习视频</a>
    <p></p>
    <!-- 引入axios库 -->
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
    <script>
        //使用axios函数
        axios({
            //目标资源地址
            url: 'http://hmajax.itheima.net/api/province'
        }).then(result => {
            console.log(result)
            console.log(result.data.list);
            //数组转为字符串输出
            console.log(result.data.list.join('<br>'));
            //把省份列表内容插入页面中
            document.querySelector('p').innerHTML = result.data.list.join('<br>');
        })

    </script>
</body>

</html>